<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="javax.sql.DataSource"%>
<%@page import="com.mixed.db.dbutil.DbUtilHelper"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
//DataSource ds = DbUtilHelper.getDataSource();
//out.print(ds);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>My JSP 'sqltag_test.jsp' starting page</title> 
  </head>
  <sql:setDataSource var="db" dataSource="jdbc/mixedDS"/>
  <body>
    <sql:query var="users" sql="select * from user where id > ?" 
    	dataSource="${db}" maxRows="10" scope="page">
    	<sql:param>1</sql:param>
    </sql:query>
    <c:out value="${users}"></c:out>
    <hr/>
    <c:forEach items="${users.rows}" var="row">
    	<c:out value="${row.id}" default="空白"></c:out>
    	<c:out value="${row.name}" default="空白"></c:out>
    	<c:out value="${row.age}" default="空白"></c:out>
    </c:forEach>
  </body>
</html>
